package com.flow.odr.serviceImpl.cdr;

import com.flow.odr.bean.cdr.vo.Cdr_VisitregnType_Vo_Bean;
import com.flow.odr.control.cdr.dto.*;
import com.flow.odr.dao.cdr.Cdr_VisitregnType_Dao;
import com.flow.odr.service.cdr.Cdr_VisitregnType_Service;
import com.flow.odr.serviceImpl.base.BaseServiceImpl;
import com.flow.odr.utils.LayDatas;
import com.flow.odr.utils.PageUtils;
import lombok.extern.slf4j.Slf4j;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Slf4j
@Service
@Transactional
public class Cdr_VisitregnType_ServiceImpl extends BaseServiceImpl<Cdr_VisitregnType_Vo_Bean> implements Cdr_VisitregnType_Service {

    @Autowired
    private Cdr_VisitregnType_Dao cdr_visitregnType_dao; // 注入dao接口

    /**
     *  @Author: Yan
     *  @Date: 2020/3/12
     *  @Description: 首页 - 今日就诊量 - 门诊实时监控
     */
    @Override
    public List<Cdr_Visit_Actual_Time_Dto_Bean> cdr_visit_actual_time() {
        return cdr_visitregnType_dao.cdr_visit_actual_time();
    }

    /**
     * @Author: Yan
     * @Date: 2020/3/12
     * @Description: 首页 - 今日就诊量 - 今日住院情况
     */
    @Override
    public List<Cdr_Visit_Actual_Time_Hospitalization_Dto_Bean> cdr_visit_actual_time_hospitalization(){
        return cdr_visitregnType_dao.cdr_visit_actual_time_hospitalization();
    }

    /**
     *  @Author: Yan
     *  @Date: 2020/3/12
     *  @Description: 首页  - 今日收入 - 今日收入
     */
    @Override
    public List<Cdr_Visit_Actual_Time_Income_Dto_Bean> cdr_visit_actual_time_income(){
        return cdr_visitregnType_dao.cdr_visit_actual_time_income();
    }

    /**
     *  @Author: Yan
     *  @Date: 2020/3/12
     *  @Description: 首页  - 今日收入 - 科室收入排行
     */

    @Override
     public  Map<String,Object> cdr_visit_actual_time_department_revenue(PageUtils pageUtils){
         PageQuery<Cdr_Visit_Actual_Time_Department_Revenue_Dto_Bean> beanPageQuery = cdr_visitregnType_dao.cdr_visit_actual_time_department_revenue(pageUtils);//   各科室排行
         List<Cdr_Visit_Actual_Time_Department_Revenue_Dto_Bean> cdr_visit_actual_time_department_revenue_dto_beans = beanPageQuery.getList();
         BigDecimal cdr_visit_actual_time_department_revenue_sum = cdr_visitregnType_dao.cdr_visit_actual_time_department_revenue_sum();  //  科室总收入
         Map<String,Object> resultMap = new HashMap<>();
         resultMap.put("department_revenue_list",cdr_visit_actual_time_department_revenue_dto_beans);
         resultMap.put("department_revenue_sum",cdr_visit_actual_time_department_revenue_sum);
         return resultMap;
     }

    /**
     *  @Author: Yan
     *  @Date: 2020/3/12
     *  @Description: 首页  - 今日收入 - 财政收入
     */
    @Override
    public LayDatas cdr_visit_actual_time_finance_table(PageUtils pageUtils){
        PageQuery pageQuery = cdr_visitregnType_dao.cdr_visit_actual_time_finance_table(pageUtils);
        return LayDatas.data(pageQuery);
    }
}
